package com.DateDemo;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Scanner;

/**
 * @Author milian
 * @Date 2021/7/22 0022 19:37
 */
public class test03 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入年份：");
        String str = sc.nextLine();
        String newStr = str+"-12-31";
        System.out.println(newStr);
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDate localDateTime = LocalDate.parse(newStr, dtf);
        int dayOfYear = localDateTime.getDayOfYear();
        System.out.println(dayOfYear);

        if (dayOfYear==365){
            System.out.println("该年是闰年");
        }else {
            System.out.println("该年是平年");
        }






    }
}
